# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1ReplayResult do
  @moduledoc """
  The result of replaying a single access tuple against a simulated state.

  ## Attributes

  *   `accessTuple` (*type:* `GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1AccessTuple.t`, *default:* `nil`) - The access tuple that was replayed. This field includes information about the principal, resource, and permission that were involved in the access attempt.
  *   `diff` (*type:* `GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1ReplayDiff.t`, *default:* `nil`) - The difference between the principal's access under the current (baseline) policies and the principal's access under the proposed (simulated) policies. This field is only included for access tuples that were successfully replayed and had different results under the current policies and the proposed policies.
  *   `error` (*type:* `GoogleApi.PolicySimulator.V1.Model.GoogleRpcStatus.t`, *default:* `nil`) - The error that caused the access tuple replay to fail. This field is only included for access tuples that were not replayed successfully.
  *   `lastSeenDate` (*type:* `GoogleApi.PolicySimulator.V1.Model.GoogleTypeDate.t`, *default:* `nil`) - The latest date this access tuple was seen in the logs.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the `ReplayResult`, in the following format: `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`, where `{resource-id}` is the ID of the project, folder, or organization that owns the Replay. Example: `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
  *   `parent` (*type:* `String.t`, *default:* `nil`) - The Replay that the access tuple was included in.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accessTuple =>
            GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1AccessTuple.t() | nil,
          :diff =>
            GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1ReplayDiff.t() | nil,
          :error => GoogleApi.PolicySimulator.V1.Model.GoogleRpcStatus.t() | nil,
          :lastSeenDate => GoogleApi.PolicySimulator.V1.Model.GoogleTypeDate.t() | nil,
          :name => String.t() | nil,
          :parent => String.t() | nil
        }

  field(:accessTuple,
    as: GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1AccessTuple
  )

  field(:diff, as: GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1ReplayDiff)
  field(:error, as: GoogleApi.PolicySimulator.V1.Model.GoogleRpcStatus)
  field(:lastSeenDate, as: GoogleApi.PolicySimulator.V1.Model.GoogleTypeDate)
  field(:name)
  field(:parent)
end

defimpl Poison.Decoder,
  for: GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1ReplayResult do
  def decode(value, options) do
    GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1ReplayResult.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.PolicySimulator.V1.Model.GoogleCloudPolicysimulatorV1ReplayResult do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
